<?php if (!defined('THINK_PATH')) exit(); /*a:1:{s:76:"C:\phpstudy\WWW\tea\public/../application/feedback\view\feedback\modify.html";i:1533279815;}*/ ?>
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="renderer" content="webkit">

    <title>新增词条管理</title>

    <meta name="keywords" content="">
    <meta name="description" content="">

    <!--[if lt IE 9]>
    <meta http-equiv="refresh" content="0;ie.html" />
    <![endif]-->

    <link rel="shortcut icon" href="favicon.ico"> <link href="/static/css/bootstrap.min.css?v=3.3.6" rel="stylesheet">
    <link href="/static/css/font-awesome.min.css?v=4.4.0" rel="stylesheet">
    <link href="/static/css/animate.css" rel="stylesheet">
    <link href="/static/css/style.css?v=4.1.0" rel="stylesheet">
</head>
<body>

<div style="width: 80%;margin: 0 auto;">
    <div class="ibox-title">
        <h5>查看新增词条</h5>
    </div>
    <form class="form-horizontal m-t" id="signupForm" action="<?php echo url('modify'); ?>" method="post" enctype="multipart/form-data">
        <div class="form-group">
            <label class="col-sm-1 control-label">榜单</label>
            <div class="col-sm-2">
                <select class="form-control m-b" name="bid" value="" style="font-size: 12px;">
                    <option value="1">匠人榜</option>
                    <option value="2">品牌榜</option>
                    <option value="3">珍品榜</option>
                </select>
            </div>
        </div>
        <button class="btn btn-primary" id="s1" type="submit" style="display: none;">提交</button>
    </form>
    <?php foreach($res as $r): ?>
    <!-- 匠人 -->
    <?php switch($r['bangdan_id']): case "1": ?>
    <div class="col-sm-12" style="position: relative;">
        <form action="<?php echo url('addjr'); ?>" method="post" enctype="multipart/form-data">
            <input type="text" name="bangdan_id" value="<?php echo $r['bangdan_id']; ?>" style="display: none;">
        <table class="table table-bordered ">
            <tr>
                <td>匠人</td>
                <td><input type="text" name="name" value="<?php echo $r['name']; ?>" style="border: none;"></td>
                <td>审核人</td>
                <td style="color: #47f"><?php if(!(empty($r['nickname']) || (($r['nickname'] instanceof \think\Collection || $r['nickname'] instanceof \think\Paginator ) && $r['nickname']->isEmpty()))): ?>
                        <?php echo $r['nickname']; endif; ?>
                </td>
            </tr>
            <tr>
                <td>茶类</td>
                <td id="<?php echo $r['Id']; ?>">
                    <select class="form-control m-b" value="<?php echo $r['teacase_id']; ?>" name="teacase_id" style="font-size: 12px; margin-bottom:0">
                    <?php foreach($teacase as $case): ?>
                    <option value="<?php echo $case['id']; ?>" <?php if($r['teacase_id'] == $case['id']): ?>selected='selected'<?php endif; ?>><?php echo $case['teaname']; ?></option>
                    <?php endforeach; ?>
                    </select>
                </td>
                <td>产区</td>
                <td class="area">
                    <select class="form-control m-b" name="teaarea_id" value="<?php echo $r['teaarea_id']; ?>" style="font-size: 12px; margin-bottom:0">
                        <?php foreach($r['area'] as $ra): ?>
                        <option value="<?php echo $r['teaarea_id']; ?>" <?php if($ra['aid'] == $r['teaarea_id']): ?>selected='selected'<?php endif; ?>><?php echo $ra['aname']; ?></option>
                        <?php endforeach; ?>
                    </select>
                </td>
            </tr>
            <tr>
                <td>联系人</td>
                <td><input type="text" name="contact" value="<?php echo $r['contact']; ?>" style="border: none;"></td>
                <td>电话</td>
                <td><input type="text" name="phone" value="<?php echo $r['phone']; ?>" style="border: none;"></td>
            </tr>
            <tr>
                <td>微信</td>
                <td><input type="text" name="wechat" value="<?php echo $r['wechat']; ?>" style="border: none;"></td>
                <td>申请时间</td>
                <td><?php echo date("Y-m-d H:i",$r['addtime']); ?></td>
            </tr>
            <tr>
                <td>简介</td>
                <td colspan="3"><textarea rows="1" cols="115" name="briefintro" style="border: none;"><?php echo $r['briefintro']; ?></textarea></td>
            </tr>
            <tr>
                <td rowspan="3">详细介绍</td>
                <td rowspan="3" colspan="3">
                    <textarea rows="5" cols="115" name="detailintro" style="border: none;"><?php echo $r['detailintro']; ?></textarea>
                </td>
            </tr>

            <?php switch($r['mark']): case "1": ?>
            <img src="/static/img/sh-t.png" style="position: absolute;top:-35px;right: -5px;width: 100px">
            <?php break; case "2": ?>
            <img src="/static/img/sh-sb.png" style="position: absolute;top:-35px;right: -5px;width: 100px">
            <?php break; default: ?>
            <img src="/static/img/sh-f.png" style="position: absolute;top:-35px;right: -5px;width: 100px">
            <?php endswitch; ?>
            <tr></tr>
            <tr></tr>
            <tr style="text-align: center;">
                <td colspan="4">
                <?php switch($r['mark']): case "0": ?>
                        <button onclick="onSuccess('<?php echo $r['Id']; ?>','<?php echo $r['bangdan_id']; ?>')">审核成功</button>
                        <button onclick="onFailed('<?php echo $r['Id']; ?>','<?php echo $r['bangdan_id']; ?>')">审核失败</button>
                     <?php break; case "1": ?>
                     已审核 
                    <button class="btn btn-primary" id="s1" type="submit" >提交入库</button>
                     <?php break; default: ?> 
                    已审核 
                <?php endswitch; ?>
                </td>
            </tr>
        </table>
        </form>  
    </div>
    <?php break; ?>
    <!-- 品牌 -->
    <?php case "2": ?>
    <div class="col-sm-12" style="position: relative;">
        <form action="<?php echo url('addpp'); ?>" method="post" enctype="multipart/form-data">
            <input type="text" name="bangdan_id" value="<?php echo $r['bangdan_id']; ?>" style="display: none;">
        <table class="table table-bordered ">
            <tr>
                <td>品牌名称</td>
                <td><input type="text" name="name" value="<?php echo $r['name']; ?>" style="border: none;"></td>
                <td>审核人</td>
                <td style="color: #47f"><?php if(!(empty($r['nickname']) || (($r['nickname'] instanceof \think\Collection || $r['nickname'] instanceof \think\Paginator ) && $r['nickname']->isEmpty()))): ?>
                        <?php echo $r['nickname']; endif; ?>
                </td>
            </tr>
            <tr>
                <td>茶类</td>
                <td>
                    <select class="form-control m-b" value="<?php echo $r['teacase_id']; ?>" name="teacase_id" style="font-size: 12px; margin-bottom:0">
                    <?php foreach($teacase as $case): ?>
                    <option value="<?php echo $case['id']; ?>" <?php if($r['teacase_id'] == $case['id']): ?>selected='selected'<?php endif; ?>><?php echo $case['teaname']; ?></option>
                    <?php endforeach; ?>
                    </select>
                </td>
                <td>产区</td>
                <td class="area">
                    <select class="form-control m-b" name="teaarea_id" value="<?php echo $r['teaarea_id']; ?>" style="font-size: 12px; margin-bottom:0">
                        <?php foreach($r['area'] as $ra): ?>
                        <option value="<?php echo $r['teaarea_id']; ?>" <?php if($ra['aid'] == $r['teaarea_id']): ?>selected='selected'<?php endif; ?>><?php echo $ra['aname']; ?></option>
                        <?php endforeach; ?>
                    </select>
                </td>
            </tr>
            <tr>
                <td>关键字</td>
                <td><input type="text" name="relatedwords" value="<?php echo $r['relatedwords']; ?>" style="border: none;"></td>
                <td>品牌销售额</td>
                <td>
                    <input type="text" name="sale" value="800万" style="border: none;">
                </td>
            </tr>
            <tr>
                <td>公司</td>
                <td><input type="text" name="company" value="<?php echo $r['company']; ?>" style="border: none;"></td>
                <td>公众号</td>
                <td><input type="text" name="pnumber" value="<?php echo $r['pnumber']; ?>" style="border: none;"></td>
            </tr>
            <tr>
                <td>联系人</td>
                <td><input type="text" name="contact" value="<?php echo $r['contact']; ?>" style="border: none;"></td>
                <td>联系电话</td>
                <td><input type="text" name="phone" value="<?php echo $r['phone']; ?>" style="border: none;"></td>
            </tr>
            <tr>
                <td>微信</td>
                <td><input type="text" name="wechat" value="<?php echo $r['wechat']; ?>" style="border: none;"></td>
                <td>申请时间</td>
                <td><?php echo date("Y-m-d H:i",$r['addtime']); ?></td>
            </tr>
            <tr>
                <td rowspan="3">详细介绍</td>
                <td rowspan="3" colspan="3">
                    <textarea rows="5" name="detailintro" cols="115" style="border: none;"><?php echo $r['detailintro']; ?></textarea>
                </td>
            </tr>
            <?php switch($r['mark']): case "1": ?>
            <img src="/static/img/sh-t.png" style="position: absolute;top:-35px;right: -5px;width: 100px">
            <?php break; case "2": ?>
            <img src="/static/img/sh-sb.png" style="position: absolute;top:-35px;right: -5px;width: 100px">
            <?php break; default: ?>
            <img src="/static/img/sh-f.png" style="position: absolute;top:-35px;right: -5px;width: 100px">
            <?php endswitch; ?>
            <tr></tr>
            <tr></tr>
            <tr style="text-align: center;">
                <td colspan="4">
                <?php switch($r['mark']): case "0": ?>
                    <button onclick="onSuccess('<?php echo $r['Id']; ?>','<?php echo $r['bangdan_id']; ?>')">审核成功</button>
                    <button onclick="onFailed('<?php echo $r['Id']; ?>','<?php echo $r['bangdan_id']; ?>')">审核失败</button>
                 <?php break; case "1": ?>
                     已审核 
                    <button class="btn btn-primary" id="s1" type="submit" >提交入库</button>
                <?php break; default: ?> 
                    已审核 
                <?php endswitch; ?>
                </td>
            </tr>
        </table>
        </form>  
    </div>
    <?php break; ?>
    <!-- 珍品 -->
    <?php case "3": ?> 
    <div class="col-sm-12" style="position: relative;">
        <form action="<?php echo url('addzp'); ?>" method="post" enctype="multipart/form-data">
            <input type="text" name="bangdan_id" value="<?php echo $r['bangdan_id']; ?>" style="display: none;">
        <table class="table table-bordered ">
            <tr>
                <td>珍品名称</td>
                <td><input type="text" name="name" value="<?php echo $r['name']; ?>" style="border: none;"></td>
                <td>审核人</td>
                <td style="color: #47f"><?php if(!(empty($r['nickname']) || (($r['nickname'] instanceof \think\Collection || $r['nickname'] instanceof \think\Paginator ) && $r['nickname']->isEmpty()))): ?>
                        <?php echo $r['nickname']; endif; ?>
                </td>
            </tr>
            <tr>
                <td>茶类</td>
                <td>
                    <select class="form-control m-b" value="<?php echo $r['teacase_id']; ?>" name="teacase_id" style="font-size: 12px; margin-bottom:0">
                    <?php foreach($teacase as $case): ?>
                    <option value="<?php echo $case['id']; ?>" <?php if($r['teacase_id'] == $case['id']): ?>selected='selected'<?php endif; ?>><?php echo $case['teaname']; ?></option>
                    <?php endforeach; ?>
                    </select>
                </td>
                <td>产区</td>
                <td class="area">
                    <select class="form-control m-b" name="teaarea_id" value="<?php echo $r['teaarea_id']; ?>" style="font-size: 12px; margin-bottom:0">
                        <?php foreach($r['area'] as $ra): ?>
                        <option value="<?php echo $r['teaarea_id']; ?>" <?php if($ra['aid'] == $r['teaarea_id']): ?>selected='selected'<?php endif; ?>><?php echo $ra['aname']; ?></option>
                        <?php endforeach; ?>
                    </select>
                </td>
            </tr>
            <tr>
                <td>出品人</td>
                <td><input type="text" name="producer" value="<?php echo $r['producer']; ?>" style="border: none;"></td>
                <td>价格（500g）</td>
                <td><input type="text" name="price" value="<?php echo $r['price']; ?>" style="border: none;"></td>
            </tr>
            <tr>
                <td>联系人</td>
                <td><input type="text" name="contact" value="<?php echo $r['contact']; ?>" style="border: none;"></td>
                <td>电话</td>
                <td><input type="text" name="phone" value="<?php echo $r['phone']; ?>" style="border: none;"></td>
            </tr>
            <tr>
                <td>微信</td>
                <td><input type="text" name="wechat" value="<?php echo $r['wechat']; ?>" style="border: none;"></td>
                <td>申请时间</td>
                <td><?php echo date("Y-m-d H:i",$r['addtime']); ?></td>
            </tr>
            <tr>
                <td>特色</td>
                <td colspan="3">
                    <label class="checkbox-inline">
                        <input type="checkbox" name="zs" id="inlineCheckbox1" <?php if($r['zs'] == '√'): ?>checked <?php endif; ?> value='√'>正山出品</label>
                    <label class="checkbox-inline">
                        <input type="checkbox" name="gs" id="inlineCheckbox1" <?php if($r['gs'] == '√'): ?>checked <?php endif; ?> value='√'>古树老丛</label>
                    <label class="checkbox-inline">
                        <input type="checkbox" name="ct" id="inlineCheckbox1" <?php if($r['ct'] == '√'): ?>checked <?php endif; ?> value='√'>传统工艺</label>
                    <label class="checkbox-inline">
                        <input type="checkbox" name="ds" id="inlineCheckbox1" <?php if($r['ds'] == '√'): ?>checked <?php endif; ?> value='√'>大师手制</label>
                </td>
            </tr>
            <tr>
               <td>其它荣誉:</td> 
               <td colspan="3">
                <label class="checkbox-inline">
                    <input id="firstname" name="orther" class="form-control" type="text" value="<?php echo $r['orther']; ?>" style="width: 600px;">
                </label>
                </td>
            </tr>
            <tr>
                <td rowspan="3">详细介绍</td>
                <td rowspan="3" colspan="3">
                    <textarea rows="5" name="detailintro" cols="115" style="border: none;"><?php echo $r['detailintro']; ?></textarea>
                </td>
            </tr>
            <?php switch($r['mark']): case "1": ?>
            <img src="/static/img/sh-t.png" style="position: absolute;top:-35px;right: -5px;width: 100px">
            <?php break; case "2": ?>
            <img src="/static/img/sh-sb.png" style="position: absolute;top:-35px;right: -5px;width: 100px">
            <?php break; default: ?>
            <img src="/static/img/sh-f.png" style="position: absolute;top:-35px;right: -5px;width: 100px">
            <?php endswitch; ?>
            <tr></tr>
            <tr></tr>
            <tr style="text-align: center;">
                <td colspan="4">
                <?php switch($r['mark']): case "0": ?>
                        <button onclick="onSuccess('<?php echo $r['Id']; ?>','<?php echo $r['bangdan_id']; ?>')">审核成功</button>
                        <button onclick="onFailed('<?php echo $r['Id']; ?>','<?php echo $r['bangdan_id']; ?>')">审核失败</button>
                     <?php break; ?>
                    {<?php case "1": ?>
                     已审核 
                    <button class="btn btn-primary" id="s1" type="submit" >提交入库</button>
                     <?php break; default: ?> 
                    已审核 
                <?php endswitch; ?>
                </td>
            </tr>
        </table>
        </form>  
    </div>
    <?php break; default: ?>未知

    <?php endswitch; endforeach; ?>
</div>







<!-- 全局js -->
<script src="/static/js/jquery.min.js?v=2.1.4"></script>
<script src="/static/js/bootstrap.min.js?v=3.3.6"></script>
<script src="/static/js/plugins/metisMenu/jquery.metisMenu.js"></script>
<script src="/static/js/plugins/slimscroll/jquery.slimscroll.min.js"></script>

<!-- 自定义js -->
<script src="/static/js/hAdmin.js?v=4.1.0"></script>
<script type="text/javascript" src="/static/js/index.js"></script>

<!-- 第三方插件 -->
<script type="text/javascript">
    $('select[name=bid]').val("<?php echo $bid; ?>");
    $("select[name=bid]").change(function(){
        $('#s1').click();
    });
    $('input[name=bangdanid]').val();

    $("select[name=teacase_id]").change(function(){
        var val = $(this).find("option:selected").attr("value");
        var area = $(this).parent().parent().find('.area').find('select[name=teaarea_id]');
        var url="<?php echo url('reTeaAreaJson'); ?>";
        $.post(url, {teacase_id:val},function(data){
            var areas = JSON.parse(data);
            var option="";
            for(index in areas){
                // console.log(areas[index]["area"])
                var a = "<option value="+areas[index]['id']+">"+areas[index]['area']+"</option>"
                option +=a
            }
            // console.log(area);
            area.html("")
            area.html(option)
        })
    })
    function onSuccess(id,bid){
        var url = '<?php echo url("modifysuccess"); ?>';
        var data = {id:id};
        $.post(url,data,function(res){
            if(res==1){
                alert("审核成功");
            }else{
                alert("审核失败，请重新审核");
            }
            window.location.replace('<?php echo url("modify"); ?>?bid='+bid)
        })
    }
    function onFailed(id,bid){
        var url = '<?php echo url("modifyfialed"); ?>';
        var data = {id:id};
        $.post(url,data,function(res){
            if(res==1){
                alert("审核失败");
            }else{
                alert("审核失败，请重新审核");
            }
            window.location.replace('<?php echo url("modify"); ?>?bid='+bid)
        })
    }
</script>

</body>
</html>